<div style="float: left; margin-right: -7px;">
	<img alt="" src="images/gray_bar_left.png" style="float: left;">
	<div style="background-image: url('images/gray_bar_middle.png'); display: inline-block; width: 726px; height: 27px; float: left">
		<div style=" display:inline-block; font-size: 10pt; font-weight: bold; color: black; margin-top: 6px; padding-left: 3px; text-transform: uppercase;">
			<?php echo $main_menu_text[lang]['contacts']; ?>
		</div>
	</div>
	<img alt="" src="images/gray_bar_right.png" style="float: left;">
</div>

<div>
        <img alt="daw" src="images/contacts_sub_header.png">
</div>

<div id="contacts-form-wrapper">
    <div>
		<?php 
			if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
				if (isset($_POST['contactName']) and isset($_POST['contactCompany']) 
					and isset($_POST['contactEmail']) and isset($_POST['contactComments'])
					and strlen($_POST['contactName']) > 0 
					and strlen($_POST['contactCompany']) > 0
					and strlen($_POST['contactEmail']) > 0
					and strlen($_POST['contactComments']) > 0) {
							
					$to = 'office@foodpackingverrines.com';
					$headers  = 'MIME-Version: 1.0' . "\r\n";
					$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
					$headers .= 'Cc: factory@gunyfal.com' . "\r\n";
					$headers .= 'From: ' . $_POST['contactName'] . ' <' . $_POST['contactEmail'] . '>' . "\r\n";
					$message = 'Company: ' . $_POST['contactCompany'] . '<br/>';
					$message .= 'Website: ' . $_POST['contactWebsite'] . '<br/>';
					$message .= 'City: ' . $_POST['contactCity'] . '<br/>';
					$message .= 'Telephone: ' . $_POST['contactTelephone'] . '<br/>';
					$message .= '<br/>' . $_POST['contactComments'] . '<br/>';
					
					mail($to, "", $message, $headers);
					echo '<h2><center>';
					echo $contacts_labels[lang]["message_sent"];
					echo '</h2></center><br/><br/>';
				} else {
					echo '<center style="color: red;">';
					if (strlen($_POST['contactName']) ==  0) {
						echo "Your ". substr($contacts_labels[lang]['name'], 0, 
							strlen($contacts_labels[lang]['name']) - 1) . " field is required!<br/>";
					}
					if (strlen($_POST['contactCompany']) ==  0) {
						echo "Your ". substr($contacts_labels[lang]['company'], 0, 
							strlen($contacts_labels[lang]['company']) - 1) . " field is required!<br/>";
					}
					if (strlen($_POST['contactEmail']) ==  0) {
						echo "Your ". substr($contacts_labels[lang]['email'], 0, 
							strlen($contacts_labels[lang]['email']) - 1) . " field is required!<br/>";
					}
					if (strlen($_POST['contactComments']) ==  0) {
						echo "Your ". substr($contacts_labels[lang]['comments'], 0, 
							strlen($contacts_labels[lang]['comments']) - 1) . " field is required!<br/>";
					}
					echo "<br/></center>";
				}
			}
		?>                                          
	</div>
        <form id="sendmail-form" action="index.php?p=contacts&lang=<?php echo lang; ?>" method="post" style="margin-left: -10px;">
                <table>
                        <tr>
                                <td class="contact-table-rows">
                                        <?php echo $contacts_labels[lang]["name"] ?>
                                </td>
                                <td>
                                        <input type="text" name="contactName" class="contact-input-fields">
                                </td>
                        </tr>
                        <tr>
                                <td class="contact-table-rows">
                                        <?php echo $contacts_labels[lang]["company"] ?>
                                </td>
                                <td>
                                        <input type="text" name="contactCompany" class="contact-input-fields">
                                </td>
                        </tr>
                        <tr>
                                <td class="contact-table-rows">
                                        <?php echo $contacts_labels[lang]["website"] ?>
                                </td>
                                <td>
                                        <input type="text" name="contactWebsite" class="contact-input-fields">
                                </td>
                        </tr>
                        <tr>
                                <td class="contact-table-rows">
                                        <?php echo $contacts_labels[lang]["city"] ?>
                                </td>
                                <td>
                                        <input type="text" name="contactCity" class="contact-input-fields">
                                </td>
                        </tr>
                        <tr>
                                <td class="contact-table-rows">
                                        <?php echo $contacts_labels[lang]["telephone"] ?>
                                </td>
                                <td>
                                        <input type="text" name="contactTelephone" class="contact-input-fields">
                                </td>
                        </tr>
                        <tr>
                                <td class="contact-table-rows">
                                        <?php echo $contacts_labels[lang]["email"] ?>
                                </td>
                                <td>
                                        <input type="text" name="contactEmail" class="contact-input-fields">
                                </td>
                        </tr>
                        <tr>
                                <td class="contact-table-rows">
                                        <?php echo $contacts_labels[lang]["comments"] ?>
                                </td>
                                <td>
                                    <textarea name="contactComments" id="contactComments" class="contact-input-fields">
                                    </textarea>
                                </td>
                        </tr>
                        <tr>
                                <td>
                                </td>
                                <td>
                                	<input id="contactSubmit" type="submit" value="<?php echo strtoupper($contacts_labels[lang]["submit"]); ?>"/>
                                    <input id="contactCancel" type="button" value="<?php echo strtoupper($contacts_labels[lang]["cancel"]); ?>" onClick="window.location.href='index.php?p=contacts&lang=<?php echo lang;?>';"/>
                                </td>
                        </tr>
                        <tr>
                                <td>
                                </td>
                                <td>
                                        <div>
                                                <?php echo $contacts_labels[lang]["fill_fields"] ?>
                                        </div>
                                </td>
                        </tr>
                        
                </table>
        </form>
</div>

<div style="margin-top: 10px;">
	<div id="contacts-separator">
		<img alt="separator" src="images/line.png">
	</div>
	<div id="contacts-content">
		<?php 
	    	echo getContent(__DB_CONTACTS_CONTENT__);
		?>
	</div>
</div>
